fix: queue messages during command_output state (Issue #10675)#10677
fix: queue messages during command_output state (Issue #10675)#10677roomote[bot] wants to merge 1 commit intomainfrom
Conversation
Review complete. No issues found. The fix correctly addresses Issue #10675 by adding Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
When a user sends a message during command_output (e.g., while a command
like `sleep 10` is running), a race condition can occur where the command
completes and updates lastMessageTs just as the user response arrives.
This causes the ask to throw AskIgnoredError("superseded") and the user
message is silently discarded.
This fix captures the pending response content (text and images) before
throwing AskIgnoredError and queues it via messageQueueService so the
message can be processed when the next ask is ready. This ensures user
messages are never lost during rapid state transitions.
Fixes EXT-674
39360eb to
c6b866c
Compare
Review Complete - No Issues FoundThis PR correctly fixes the race condition described in Issue #10675 where user messages sent during Changes ReviewedThe fix at
VerdictLGTM - Ready for merge (requires approval from another reviewer since self-approval is not permitted). |
Related GitHub Issue
Closes: #10675
Roo Code Task Context (Optional)
This PR was created by Roo Code to address the reported bug.
Description
This PR fixes the issue where user messages sent while a command is running (during the
command_outputstate) would "disappear" and not be acknowledged by the agent.Root Cause:
When a command is running (
command_outputstate), the following conditions are set:sendingDisabled = false(user can type)isStreaming = false(no API request in progress)messageQueue.length = 0(typically empty)Because none of the existing queue conditions were true, messages were sent directly as
askResponseinstead of being queued. These messages were then lost because the backend was waiting for terminal feedback, not a user message.The Fix:
Added
clineAsk === "command_output"to the queue condition inhandleSendMessage. Now when a command is running, user messages are queued instead of sent directly, ensuring they are processed once the command completes.Test Procedure
Unit Test: Added a test case
queues messages when command is running (command_output state) - Issue #10675that verifies:command_outputstate, messages are sent asqueueMessagetypeaskResponse(which would cause them to be lost)Manual Testing:
sleep 60)Run the tests:
Pre-Submission Checklist
Screenshots / Videos
N/A - This is a behavioral fix with no UI changes.
Documentation Updates
Additional Notes
This is an attempt to address Issue #10675. Feedback and guidance are welcome!
Get in Touch
@roomote
Important
Fixes message loss during
command_outputstate by queuing user messages inTask.ts.command_outputstate by queuing user messages inTask.ts.clineAsk === "command_output"to queue condition inask()method.queues messages when command is running (command_output state) - Issue #10675to verify queuing behavior.This description was created by
for c6b866c. You can customize this summary. It will automatically update as commits are pushed.